<template>
  <div class="content-div">
    <div class="gn-box">
      <div @click="toPage()" class="gn-item">
        <span>当前版本</span>
        <span>V2</span>
      </div>
      <div @click="toPage()" class="gn-item">
        <span>检查更新</span>
        <van-icon color="#999999" name="arrow" />
      </div>
      <div @click="toPage('/chooseIdentity')" class="gn-item">
        <span>切换身份</span>
        <span>当前身份<van-icon color="#999999" name="arrow" /></span>
      </div>
    </div>
    <div @click="logout" class="logout-btn-box">退出登录</div>
  </div>
</template>
<script>
import { Dialog } from 'vant'
import { clearToken } from '@/libs/util.js'
export default {
  name: 'index',
  data () {
    return {}
  },
  created () {},
  methods: {
    toPage (url) {
      this.$router.push(url)
    },
    logout () {
      Dialog.confirm({
        title: '提示',
        message: '确定退出登录当前账号？'
      }).then(() => {
        this.$store.commit('setToken', null)
        this.$store.commit('setSeverUserInfo', null)
        clearToken()
        this.$router.replace('/login')
      })
    }
  },
  mounted () {}
}
</script>

<style scoped lang="less">
  .content-div{
    font-size: 12px;
    background-color: #F8F8F8;
    min-height: 100%;
    position: relative;
    .gn-box{
      box-sizing: border-box;
      padding: 10px;
      .gn-item{
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        box-sizing: border-box;
        padding: 10px;
        margin-bottom: 10px;
        background-color: #FFFFFF;
        border-radius: 6px;
      }
    }
    .logout-btn-box{
      position: absolute;
      bottom: 10px;
      text-align: center;
      background-color: #1989fa;
      width: 300px;
      height: 30px;
      line-height: 30px;
      border-radius: 6px;
      left: 10px;
      color: #FFFFFF;
    }
  }
</style>
